package com.cskaoyan.controller;

import com.cskaoyan.pojo.BaseRespVo;
import com.cskaoyan.pojo.DataBean;
import com.cskaoyan.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @Auther yuan sun
 * @Date 2021/4/6 22:43
 */
@RestController
public class UserController {
    /**
     * 后面需要修改这个return id   需要学习Shiro 安全框架
     *
     * @param user
     * @return
     */
    @PostMapping("/admin/auth/login")
    public BaseRespVo login(@RequestBody User user) {
        System.out.println (user);
        return BaseRespVo.ok ("8d3aad48-81b1-482d-ad8f-a58afd98ad75");
    }

    @GetMapping("/admin/auth/info")
    public BaseRespVo info() {
        ArrayList<String> list = new ArrayList<> ();
        list.add ("超级管理员");
        ArrayList<String> list2 = new ArrayList<> ();
        list2.add ("*");
        return BaseRespVo.ok (new DataBean ("admin123", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
                list, list2), "成功");
    }

}
